//package com.authine.cloudpivot.ext.applicationservice;
//
//import com.alibaba.cola.dto.SingleResponse;
//import com.alibaba.fastjson.JSON;
//import com.alibaba.fastjson.JSONObject;
//import com.authine.cloudpivot.ext.applicationservice.base.ApplicationBaseService;
//import com.authine.cloudpivot.ext.constants.AppConst;
//import com.authine.cloudpivot.ext.constants.ModelConst;
//import com.authine.cloudpivot.ext.dto.transfer.*;
//import com.authine.cloudpivot.ext.enums.order.OrderCustomerStatusEnum;
//import com.authine.cloudpivot.ext.enums.order.transfer.MemberPurchaseOrderEnum;
//import com.authine.cloudpivot.ext.enums.report.ReportType;
//import com.authine.cloudpivot.ext.service.TransferOrderService;
//import com.authine.cloudpivot.ext.service.impl.TransferOrderServiceImpl;
//import com.authine.cloudpivot.ext.utils.BoResultFormat;
//import com.authine.cloudpivot.ext.utils.BoServiceUtils;
//import com.authine.cloudpivot.ext.utils.JdbcTemplateUtils;
//import com.authine.cloudpivot.ext.utils.StringUtils;
//import com.authine.cloudpivot.ext.utils.boQuery.BoQueryUtils;
//import com.authine.cloudpivot.ext.utils.system.ReportUtils;
//import com.authine.common.json.JsonUtils;
//import com.authine.mvp.app.launcher.domain.utills.ApplicationContextUtils;
//import com.authine.mvp.app.launcher.dto.bo.response.BO;
//import com.authine.mvp.app.launcher.dto.bo.response.BOList;
//import com.authine.mvp.app.launcher.rpc.SaveOrUpdateBO;
//import io.swagger.v3.oas.annotations.Operation;
//import io.swagger.v3.oas.annotations.Parameter;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.dao.DataAccessException;
//import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
//import org.springframework.util.CollectionUtils;
//import org.springframework.util.ObjectUtils;
//
//import javax.ws.rs.POST;
//import javax.ws.rs.Path;
//
//import java.math.BigDecimal;
//import java.util.*;
//import java.util.stream.Collectors;
//
//import static com.authine.hermes.app.launcher.service.ApplicationServiceFoundation.CUSTOM_SERVICE;
//
///**
// * @ClassName TransferManageOrderService
// * @Description: 转采管理自定义服务
// * @Author cjj
// * @Date 2021/6/18
// * @Version V1.0
// **/
//@Path("TransferManageOrderService")
//@Slf4j
//public class TransferManageOrderService extends ApplicationBaseService {
//    private TransferOrderService transferOrderService = new TransferOrderServiceImpl();
//    private NamedParameterJdbcTemplate jdbcTemplate = ApplicationContextUtils.getBean(NamedParameterJdbcTemplate.class);
//
//    /**
//     * 转采客户订单商品分页列表/采购商品历史分页列表
//     *
//     * @param dto
//     * @return
//     */
//    @Path("transferOrderGoods")
//    @POST
//    @Operation(summary = "转采管理-转采客户订单商品列表分页查询/转采管理-采购商品历史列表分页查询", tags = CUSTOM_SERVICE, description = "pageIndex、pageSize、not_purchase、del必填")
//    public SingleResponse<BOList> transferOrderGoods(@Parameter TransferOrderGoodsDto dto) {
//        log.info("------------------------转采管理-转采客户订单商品列表分页查询/转采管理-采购商品历史列表分页查询 transferOrderGoods Param：{}------------------------", JsonUtils.toJson(dto));
//        if (null == dto.getPageIndex() || null == dto.getPageSize()) {
//            return SingleResponse.buildFailure("-1", "pageIndex、pageSize必填");
//        }
//        if (null == dto.getNot_purchase()) {
//            return SingleResponse.buildFailure("-1", "是否再次采购必填");
//        }
//        String transferOrderTableName = getTableName(ModelConst.T_TRANSFER_ORDER);
//        String transferOrderGoodsTableName = getTableName(ModelConst.T_TRANSFER_ORDER_GOODS);
//        String orderGoodsReturnsTableName = getTableName(ModelConst.T_ORDER_GOODS_RETURNS);
//        Map<String, Object> parameter = new HashMap<>();
//        StringBuilder listSql = new StringBuilder();
//        StringBuilder whereSql = new StringBuilder();
//        StringBuilder countSql = new StringBuilder();
//        listSql.append("SELECT case when tg.returns_quantity is null or tg.returns_quantity = '' then gr.quantity else null end as returns_quantity," +
//                "case when t.order_type='Contract' then '是' else '否' end as is_contract," +
//                "case when tg.purchasing_agent_id is null or tg.purchasing_agent_id = '' then '是' else '否' end as is_assign_buyer," +
//                " tg.*, t.* FROM " + transferOrderGoodsTableName + " tg " +
//                "LEFT JOIN " + transferOrderTableName + " t on tg.transfer_order_id = t.id " +
//                "LEFT JOIN " + orderGoodsReturnsTableName + " gr on gr.order_customer_goods_id = tg.cloud_order_goods_id " +
//                "WHERE t.order_type='purchase'");
//        countSql.append("SELECT count(*) FROM " + transferOrderGoodsTableName + " tg " +
//                "LEFT JOIN " + transferOrderTableName + " t on tg.transfer_order_id = t.id " +
//                "LEFT JOIN " + orderGoodsReturnsTableName + " gr on gr.order_customer_goods_id = tg.cloud_order_goods_id " +
//                "WHERE t.order_type='purchase'");
//        //拼接参数
//        if (null != dto.getNot_purchase()) {
//            whereSql.append(" and tg.not_purchase = :not_purchase ");
//            parameter.put("not_purchase", dto.getNot_purchase());
//        }
//        //平台客户订单号
//        if (StringUtils.isNotBlank(dto.getCloud_order_id())) {
//            List<String> cloudOrderIds = StringUtils.stringToListString(dto.getCloud_order_id(), ";");
//            whereSql.append(" and t.cloud_order_id in (:cloud_order_id) ");
//            parameter.put("cloud_order_id", cloudOrderIds);
//        }
//        //平台客户订单商品号
//        if (StringUtils.isNotBlank(dto.getCloud_order_goods_id())) {
//            List<String> cloudOrderGoodsIds = StringUtils.stringToListString(dto.getCloud_order_goods_id(), ";");
//            whereSql.append(" and tg.cloud_order_goods_id in (:cloud_order_goods_id) ");
//            parameter.put("cloud_order_goods_id", cloudOrderGoodsIds);
//        }
//        //询价单号
//        if (StringUtils.isNotBlank(dto.getInquiry_id())) {
//            List<String> inquiryIds = StringUtils.stringToListString(dto.getInquiry_id(), ";");
//            whereSql.append(" and tg.inquiry_id in (:inquiry_id) ");
//            parameter.put("inquiry_id", inquiryIds);
//        }
//        //名称
//        if (StringUtils.isNotBlank(dto.getName())) {
//            whereSql.append(" and tg.name like :name ");
//            parameter.put("name", "%" + dto.getName() + "%");
//        }
//        //品牌
//        if (StringUtils.isNotBlank(dto.getBrand())) {
//            whereSql.append("and tg.brand like :brand ");
//            parameter.put("brand", "%" + dto.getBrand() + "%");
//        }
//        //型号
//        if (StringUtils.isNotBlank(dto.getModel())) {
//            whereSql.append(" and tg.model like :model ");
//            parameter.put("model", "%" + dto.getModel() + "%");
//        }
//        //供应商
//        if (StringUtils.isNotBlank(dto.getVendor_name())) {
//            whereSql.append(" and tg.vendor_name like :vendor_name ");
//            parameter.put("vendor_name", "%" + dto.getVendor_name() + "%");
//        }
//        //下单组织
//        if (StringUtils.isNotBlank(dto.getOrganization_name())) {
//            whereSql.append(" and t.organization_name like :organization_name ");
//            parameter.put("organization_name", "%" + dto.getOrganization_name() + "%");
//        }
//        //平台组织名称
//        if (StringUtils.isNotBlank(dto.getPlatform_name())) {
//            whereSql.append(" and t.platform_name like :platform_name ");
//            parameter.put("platform_name", "%" + dto.getPlatform_name() + "%");
//        }
//        //采购员
//        if (StringUtils.isNotBlank(dto.getPurchase_agent_name())) {
//            whereSql.append(" and tg.purchase_agent_name like :purchase_agent_name ");
//            parameter.put("purchase_agent_name", "%" + dto.getPurchase_agent_name() + "%");
//        }
//        //商品状态
//        if (StringUtils.isNotBlank(dto.getTransfer_order_goods_status())) {
//            whereSql.append(" and tg.transfer_order_goods_status = :transfer_order_goods_status ");
//            parameter.put("transfer_order_goods_status", dto.getTransfer_order_goods_status());
//        }
//        //下单日期
//        if (!CollectionUtils.isEmpty(dto.getCreatedTimes()) && dto.getCreatedTimes().size() >= 2) {
//            whereSql.append(" and t.createdTime between :startTime and :endTime ");
//            parameter.put("startTime", dto.getCreatedTimes().get(0));
//            parameter.put("endTime", dto.getCreatedTimes().get(1));
//        }
//        //未分配采购员
//        if (StringUtils.isNotBlank(dto.getIs_assign_buyer()) && dto.getIs_assign_buyer().equals("1")) {
//            whereSql.append(" and (tg.purchasing_agent_id is null or tg.purchasing_agent_id = '') ");
//        }
//        countSql.append(whereSql);
//        listSql.append(whereSql);
//        listSql.append(" order by tg.createdTime desc");
//        listSql.append(" limit " + dto.getPageIndex() * dto.getPageSize() + ", " + dto.getPageSize());
//        log.info("------------------------转采管理-转采客户订单商品列表分页查询/转采管理-采购商品历史列表分页查询 transferOrderGoods listSql：{}------------------------parameter：{}", listSql, JsonUtils.toJson(parameter));
//        List<Map<String, Object>> resultList = jdbcTemplate.queryForList(listSql.toString(), parameter);
//        Integer count = 0;
//        try {
//            count = jdbcTemplate.queryForObject(countSql.toString(), parameter, Integer.class);
//        } catch (DataAccessException e) {
//            e.printStackTrace();
//        }
//        //构建结果集
//        BoResultFormat.resultFormat(resultList, ModelConst.T_TRANSFER_ORDER_GOODS);
//        BOList bOList = new BOList();
//        bOList.setData(resultList);
//        bOList.setTotal(count);
//        bOList.setSchemaCode(ModelConst.T_TRANSFER_ORDER_GOODS);
//        return SingleResponse.of(bOList);
//    }
//
//    /**
//     * 转采管理-转采客户订单商品-分配采购员-提交选择采购员
//     *
//     * @param dto
//     * @return
//     */
//    @Path("savePurchasingAgent")
//    @POST
//    @Operation(summary = "转采管理-转采客户订单商品-分配采购员-提交选择采购员", tags = CUSTOM_SERVICE, description = "ids、purchasing_agent_id必填")
//    public SingleResponse<Boolean> savePurchasingAgent(@Parameter TransferOrderGoodsDto dto) {
//        if (CollectionUtils.isEmpty(dto.getIds())) {
//            return SingleResponse.buildFailure("-1", "转采订单商品ID集合必填");
//        }
//        if (StringUtils.isBlank(dto.getPurchasing_agent_id())) {
//            return SingleResponse.buildFailure("-1", "采购人必填");
//        }
//        boolean flag = transferOrderService.updatePurchaseAgent(dto.getIds(), dto.getPurchasing_agent_id());
//        return SingleResponse.of(flag);
//    }
//
//    /**
//     * 转采管理-转采客户订单商品-生成采购订单
//     *
//     * @param dto
//     * @return
//     */
//    @Path("saveTransferOrder")
//    @POST
//    @Operation(summary = "转采管理-转采客户订单商品-生成采购订单", tags = CUSTOM_SERVICE, description = "payment_id、vendor_id、memberPurchaseOrderGoods必填")
//    public SingleResponse<BO> saveTransferOrder(@Parameter MemberPurchaseOrderDto dto) {
//        if (null == dto) {
//            return SingleResponse.buildFailure("-1", "转采订单必填");
//        }
//        if (CollectionUtils.isEmpty(dto.getMemberPurchaseOrderGoods())) {
//            return SingleResponse.buildFailure("-1", "转采订单商品集合必填");
//        }
//        SingleResponse<BO> result = transferOrderService.submitTransferOrder(dto);
//        return result;
//    }
//
//    /**
//     * 转采管理-转采客户订单商品-标记已采购/转采管理-采购商品历史-返回待采
//     *
//     * @param dto
//     * @return
//     */
//    @Path("markPurchased")
//    @POST
//    @Operation(summary = "转采管理-转采客户订单商品-标记已采购/转采管理-采购商品历史-返回待采", tags = CUSTOM_SERVICE, description = "ids、notPurchase(true：为标价已采购 false：为返回待采)、reason必填")
//    public SingleResponse<Boolean> markPurchased(@Parameter TransferOrderGoodsDto dto) {
//        if (CollectionUtils.isEmpty(dto.getIds())) {
//            return SingleResponse.buildFailure("-1", "转采订单商品ID集合必填");
//        }
//        if (StringUtils.isBlank(dto.getNot_purchase())) {
//            return SingleResponse.buildFailure("-1", "是否再次采购必填");
//        }
//        if (StringUtils.isBlank(dto.getReason())) {
//            return SingleResponse.buildFailure("-1", "标记已采购原因必填");
//        }
//        boolean flag = transferOrderService.tagPurchaseGoods(dto.getIds(), dto.getNot_purchase(), dto.getReason());
//        return SingleResponse.of(flag);
//    }
//
//    /**
//     * 转采管理-采购订单列表
//     *
//     * @param dto
//     * @return
//     */
//    @Path("transferPurchaseOrderList")
//    @POST
//    @Operation(summary = "转采管理-采购订单列表分页查询", tags = CUSTOM_SERVICE, description = "pageIndex、pageSize必填")
//    public SingleResponse<BOList> transferPurchaseOrderList(@Parameter MemberPurchaseOrderDto dto) {
//        log.info("------------------------转采管理-采购订单列表分页查询 transferPurchaseOrderList Param：{}------------------------", JsonUtils.toJson(dto));
//        if (null == dto.getPageIndex() || null == dto.getPageSize()) {
//            return SingleResponse.buildFailure("-1", "pageIndex、pageSize必填");
//        }
//        String mpoTableName = getTableName(ModelConst.T_MEMBER_PURCHASE_ORDER);
//        String paTableName = getTableName(AppConst.SYSTEM_MANAGEMENT, ModelConst.T_PAY_ACCOUNT);
//        String pwTableName = getTableName(AppConst.SYSTEM_MANAGEMENT, ModelConst.T_PAYMENT_WAY);
//        String tvTableName = getTableName(ModelConst.T_TRANSFER_ORDER);
//        Map<String, Object> parameter = new HashMap<>();
//        StringBuilder listSql = new StringBuilder();
//        StringBuilder whereSql = new StringBuilder();
//        StringBuilder countSql = new StringBuilder();
//        listSql.append("select * from " + mpoTableName + " mpo " +
//                " LEFT JOIN " + pwTableName + " pw on mpo.payment_id = pw.id " +
//                " LEFT JOIN " + paTableName + " pa on mpo.pay_account_id = pw.id " +
//                " LEFT JOIN " + tvTableName + " tv on mpo.vendor_id = tv.id where mpo.deleted = '0' ");
//        countSql.append("select count(*) from " + mpoTableName + " mpo " +
//                " LEFT JOIN " + pwTableName + " pw on mpo.payment_id = pw.id " +
//                " LEFT JOIN " + paTableName + " pa on mpo.pay_account_id = pw.id " +
//                " LEFT JOIN " + tvTableName + " tv on mpo.vendor_id = tv.id  where mpo.deleted = '0'");
//        //采购单ID
//        if (StringUtils.isNotBlank(dto.getId())) {
//            List<String> ids = StringUtils.stringToListString(dto.getId(), ";");
//            whereSql.append(" and mpo.id in (:id) ");
//            parameter.put("id", ids);
//        }
//        //采购P单
//        if (StringUtils.isNotBlank(dto.getPo_code())) {
//            List<String> poCodes = StringUtils.stringToListString(dto.getPo_code(), ";");
//            whereSql.append(" and mpo.po_code in (:po_code) ");
//            parameter.put("po_code", poCodes);
//        }
//        //云平台订单
//        if (StringUtils.isNotBlank(dto.getCloud_order_ids())) {
//            List<String> cloudOrderIds = StringUtils.stringToListString(dto.getCloud_order_ids(), ";");
//            whereSql.append(" and mpo.cloud_order_ids in (:cloud_order_ids) ");
//            parameter.put("cloud_order_ids", cloudOrderIds);
//        }
//        //采购员
//        if (StringUtils.isNotBlank(dto.getBuyer())) {
//            whereSql.append(" and mpo.buyer like :buyer ");
//            parameter.put("buyer", "%" + dto.getBuyer() + "%");
//        }
//        //供应商
//        if (StringUtils.isNotBlank(dto.getVendor_id())) {
//            whereSql.append(" and tv.company_name like :vendor_id ");
//            parameter.put("vendor_id", "%" + dto.getVendor_id() + "%");
//        }
//        //客户
//        if (StringUtils.isNotBlank(dto.getCustomer_name())) {
//            whereSql.append(" and mpo.customer_name like :customer_name ");
//            parameter.put("customer_name", "%" + dto.getCustomer_name() + "%");
//        }
//        //备注
//        if (StringUtils.isNotBlank(dto.getMemo())) {
//            whereSql.append(" and mpo.memo like :memo ");
//            parameter.put("memo", "%" + dto.getMemo() + "%");
//        }
//        //付款方式
//        if (StringUtils.isNotBlank(dto.getPayment_id())) {
//            whereSql.append(" and mpo.payment_id = :payment_id ");
//            parameter.put("payment_id", dto.getPayment_id());
//        }
//        //平台组织名称
//        if (StringUtils.isNotBlank(dto.getPlatform_name())) {
//            whereSql.append(" and mpo.platform_name like :platform_name ");
//            parameter.put("platform_name", "%" + dto.getPlatform_name() + "%");
//        }
//        //采购单付款状态
//        if (StringUtils.isNotBlank(dto.getMember_purchase_order_status())) {
//            whereSql.append(" and mpo.member_purchase_order_status = :member_purchase_order_status ");
//            parameter.put("member_purchase_order_status", dto.getMember_purchase_order_status());
//        }
//        //采购单收票状态
//        if (StringUtils.isNotBlank(dto.getInvoice_status())) {
//            whereSql.append(" and mpo.invoice_status = :invoice_status ");
//            parameter.put("invoice_status", dto.getInvoice_status());
//        }
//        //付款方式
//        if (StringUtils.isNotBlank(dto.getPlatform_name())) {
//            whereSql.append(" and mpo.payment_name like :payment_name ");
//            parameter.put("payment_name", "%" + dto.getPlatform_name() + "%");
//        }
//        //发票类型
//        if (StringUtils.isNotBlank(dto.getInvoice_type())) {
//            whereSql.append(" and mpo.invoice_type = :invoice_type ");
//            parameter.put("invoice_type", dto.getInvoice_type());
//        }
//        //采购总价（含）
//        if (null != dto.getPurchase_amount()) {
//            whereSql.append(" and mpo.purchase_amount like :purchase_amount ");
//            parameter.put("purchase_amount", "%" + dto.getPurchase_amount() + "%");
//        }
//        //审核人
//        if (StringUtils.isNotBlank(dto.getApprove_user_name())) {
//            whereSql.append(" and mpo.approve_user_name like :approve_user_name ");
//            parameter.put("approve_user_name", "%" + dto.getApprove_user_name() + "%");
//        }
//        //账期
//        if (null != dto.getAccount_period()) {
//            whereSql.append(" and mpo.account_period like :account_period ");
//            parameter.put("account_period", "%" + dto.getAccount_period() + "%");
//        }
//        //转采日期
//        if (!CollectionUtils.isEmpty(dto.getCreatedTime()) && dto.getCreatedTime().size() >= 2) {
//            whereSql.append(" and mpo.createdTime between :startTime and :endTime ");
//            parameter.put("startTime", dto.getCreatedTime().get(0));
//            parameter.put("endTime", dto.getCreatedTime().get(1));
//        }
//        //审核日期
//        if (!CollectionUtils.isEmpty(dto.getApprove_time()) && dto.getApprove_time().size() >= 2) {
//            whereSql.append(" and mpo.approve_time between :approveStartTime and :approveEndTime ");
//            parameter.put("approveStartTime", dto.getApprove_time().get(0));
//            parameter.put("approveEndTime", dto.getApprove_time().get(1));
//        }
//        //收票金额大于0
//        if (null != dto.getInvoice_price() && dto.getInvoice_price().compareTo(BigDecimal.ZERO) == 0) {
//            whereSql.append(" and mpo.invoice_price > 0 ");
//        }
//        countSql.append(whereSql);
//        listSql.append(whereSql);
//        listSql.append(" order by mpo.createdTime desc");
//        listSql.append(" limit " + dto.getPageIndex() * dto.getPageSize() + ", " + dto.getPageSize());
//        log.info("------------------------转采管理-转采客户订单商品列表分页查询/转采管理-采购商品历史列表分页查询 transferOrderGoods listSql：{}------------------------parameter：{}", listSql, JsonUtils.toJson(parameter));
//        List<Map<String, Object>> resultList = jdbcTemplate.queryForList(listSql.toString(), parameter);
//        Integer count = 0;
//        try {
//            count = jdbcTemplate.queryForObject(countSql.toString(), parameter, Integer.class);
//        } catch (DataAccessException e) {
//            e.printStackTrace();
//        }
//        //构建结果集
//        BoResultFormat.resultFormat(resultList, ModelConst.T_MEMBER_PURCHASE_ORDER);
//        BOList bOList = new BOList();
//        bOList.setData(resultList);
//        bOList.setTotal(count);
//        bOList.setSchemaCode(ModelConst.T_MEMBER_PURCHASE_ORDER);
//        return SingleResponse.of(bOList);
//    }
//
//    /**
//     * 转采管理-采购订单-审核通过
//     *
//     * @param dto
//     * @return
//     */
//    @Path("applyApproved")
//    @POST
//    @Operation(summary = "转采管理-采购订单-审核通过", tags = CUSTOM_SERVICE, description = "ids必填")
//    public SingleResponse applyApproved(@Parameter MemberPurchaseOrderDto dto) {
//        if (CollectionUtils.isEmpty(dto.getIds())) {
//            return SingleResponse.buildFailure("-1", "会员采购订单ID集合必填");
//        }
//        //TODO 判断当前用户是否为“平台采购员”
//        return transferOrderService.approvePurchaseOrder(dto.getIds());
//    }
//
//    /**
//     * 转采管理-采购订单-驳回
//     *
//     * @param dto
//     * @return
//     */
//    @Path("applyReject")
//    @POST
//    @Operation(summary = "转采管理-采购订单-驳回", tags = CUSTOM_SERVICE, description = "ids必填")
//    public SingleResponse<Boolean> applyReject(@Parameter MemberPurchaseOrderDto dto) {
//        if (CollectionUtils.isEmpty(dto.getIds())) {
//            return SingleResponse.buildFailure("-1", "会员采购订单ID集合必填");
//        }
//        //TODO 判断当前用户是否为“平台采购员”
//        Boolean flag = transferOrderService.disapprovePurchaseOrder(dto.getIds());
//        return SingleResponse.of(flag);
//    }
//
//    /**
//     * 转采管理-采购订单-申请付款列表-提交申请付款
//     *
//     * @param dto
//     * @return
//     */
//    @Path("applyPayment")
//    @POST
//    @Operation(summary = "转采管理-采购订单-申请付款列表-提交申请付款", tags = CUSTOM_SERVICE, description = "purchase_amount、payment_amount、sale_amount必填")
//    public SingleResponse<BO> applyPayment(@Parameter PurchaseRequestPaymentDto dto) {
//        if (null == dto || CollectionUtils.isEmpty(dto.getPaymentDetails())) {
//            return SingleResponse.buildFailure("-1", "采购单，采购付款明细必填");
//        }
//        return transferOrderService.savePurchaseRequestPayment(dto);
//    }
//
//    /**
//     * 转采管理-采购订单-采购收票-提交收票单
//     *
//     * @param dto
//     * @return
//     */
//    @Path("savePurchaseOrder")
//    @POST
//    @Operation(summary = "转采管理-采购订单-提交收票单", tags = CUSTOM_SERVICE, description = "dto、dto.invoice_amount、dto.purchaseInvoiceDetails必填")
//    public SingleResponse<BO> savePurchaseOrder(@Parameter PurchaseInvoiceDto dto) {
//        return transferOrderService.submitPurchaseOrder(dto);
//    }
//
//    /**
//     * 转采管理-采购订单-修改付款方式
//     *
//     * @param dto
//     * @return
//     */
//    @Path("updatePaymentWay")
//    @POST
//    @Operation(summary = "转采管理-采购订单-修改付款方式", tags = CUSTOM_SERVICE, description = "ids、payment_id、payment_name必填")
//    public SingleResponse<BO> updatePaymentWay(@Parameter MemberPurchaseOrderDto dto) {
//        if (CollectionUtils.isEmpty(dto.getIds())) {
//            return SingleResponse.buildFailure("-1", "采购申请支付ID必填");
//        }
//        if (StringUtils.isBlank(dto.getPayment_id())) {
//            return SingleResponse.buildFailure("-1", "付款方式ID必填");
//        }
//        if (StringUtils.isBlank(dto.getPayment_name())) {
//            return SingleResponse.buildFailure("-1", "付款方式名称必填");
//        }
//        List<Map<String, Object>> orderParams = new ArrayList<>();
//        for (String id : dto.getIds()) {
//            Map<String, Object> orderParam = new HashMap<>();
//            orderParam.put("id", id);
//            orderParam.put("payment_id", dto.getPayment_id());
//            orderParam.put("payment_name", dto.getPayment_name());
//            orderParams.add(orderParam);
//        }
//        return BoServiceUtils.updateMainBo(ModelConst.T_MEMBER_PURCHASE_ORDER, orderParams);
//    }
//
//    /**
//     * 转采管理-采购订单-修改订单
//     *
//     * @param dto
//     * @return
//     */
//    @Path("updatePurchaseOrder")
//    @POST
//    @Operation(summary = "转采管理-采购订单-修改订单", tags = CUSTOM_SERVICE, description = "dto、memberPurchaseOrderGoods必填")
//    public SingleResponse<BO> updatePurchaseOrder(@Parameter MemberPurchaseOrderDto dto) {
//        if (null == dto) {
//            return SingleResponse.buildFailure("-1", "转采订单必填");
//        }
//        if (CollectionUtils.isEmpty(dto.getMemberPurchaseOrderGoods())) {
//            return SingleResponse.buildFailure("-1", "转采订单商品集合必填");
//        }
//        SingleResponse<BO> result = transferOrderService.editPurchaseOrder(dto);
//        return result;
//    }
//
//    /**
//     * 转采管理-采购订单-修改付款方式
//     *
//     * @param dtos
//     * @return
//     */
//    @Path("updateContractStatus")
//    @POST
//    @Operation(summary = "转采管理-采购订单-修改合同状态", tags = CUSTOM_SERVICE, description = "id, contract_or_sent必填：eg:[{\"id\":\"10672\",\"contract_or_sent\":false}]")
//    public SingleResponse<BO> updateContractStatus(@Parameter List<MemberPurchaseOrderDto> dtos) {
//        if (CollectionUtils.isEmpty(dtos)) {
//            return SingleResponse.buildFailure("-1", "会员采购订单必填");
//        }
//        List<Map<String, Object>> orderParams = new ArrayList<>();
//        for (MemberPurchaseOrderDto dto : dtos) {
//            if (StringUtils.isBlank(dto.getId())) {
//                return SingleResponse.buildFailure("-1", "采购申请支付ID必填");
//            }
//            if (null == dto.getContract_or_sent()) {
//                return SingleResponse.buildFailure("-1", "合同是否已发必填");
//            }
//            Map<String, Object> orderParam = new HashMap<>();
//            orderParam.put("id", dto.getId());
//            orderParam.put("contract_or_sent", dto.getContract_or_sent() ? true : false);
//            orderParams.add(orderParam);
//        }
//        return BoServiceUtils.updateMainBo(ModelConst.T_MEMBER_PURCHASE_ORDER, orderParams);
//    }
//
//    /**
//     * 转采管理-采购订单-取消审核
//     *
//     * @param dto
//     * @return
//     */
//    @Path("cancelCheck")
//    @POST
//    @Operation(summary = "转采管理-采购订单-取消审核", tags = CUSTOM_SERVICE, description = "ids必填")
//    public SingleResponse<Boolean> cancelCheck(@Parameter MemberPurchaseOrderDto dto) {
//        if (CollectionUtils.isEmpty(dto.getIds())) {
//            return SingleResponse.buildFailure("-1", "会员采购订单ID集合必填");
//        }
//        return SingleResponse.of(transferOrderService.purchaseReturn(dto.getIds(), 2));
//    }
//
//    /**
//     * 转采管理-采购订单-采购单作废
//     *
//     * @param dto
//     * @return
//     */
//    @Path("purchaseCancel")
//    @POST
//    @Operation(summary = "转采管理-采购订单-采购单作废", tags = CUSTOM_SERVICE, description = "ids必填")
//    public SingleResponse<Boolean> purchaseCancel(@Parameter MemberPurchaseOrderDto dto) {
//        if (CollectionUtils.isEmpty(dto.getIds())) {
//            return SingleResponse.buildFailure("-1", "会员采购订单ID集合必填");
//        }
//        return SingleResponse.of(transferOrderService.purchaseReturn(dto.getIds(), 1));
//    }
//
//    /**
//     * 转采管理-采购订单-不再付款
//     *
//     * @param dto
//     * @return
//     */
//    @Path("noPayment")
//    @POST
//    @Operation(summary = "转采管理-采购订单-不再付款", tags = CUSTOM_SERVICE, description = "ids必填")
//    public SingleResponse<BO> noPayment(@Parameter MemberPurchaseOrderDto dto) {
//        if (CollectionUtils.isEmpty(dto.getIds())) {
//            return SingleResponse.buildFailure("-1", "会员采购订单ID集合必填");
//        }
//        List<Map<String, Object>> memberPurchaseOrders = JdbcTemplateUtils.builder(ModelConst.T_MEMBER_PURCHASE_ORDER)
//                .selectField("*").in("id", dto.getIds()).queryForList();
//        List<Map<String, Object>> memberPurchaseOrdersParams = new ArrayList<>();
//        for (Map<String, Object> mps : memberPurchaseOrders) {
//            if (!mps.get("member_purchase_order_status").equals(MemberPurchaseOrderEnum.PARTIAL.id.toString())) {
//                throw new RuntimeException("请选择部分付款的进行操作");
//            }
//            Map<String, Object> memberPurchaseOrdersParam = new HashMap<>();
//            memberPurchaseOrdersParam.put("no_more_payment", true);
//            memberPurchaseOrdersParam.put("id", mps.get("id"));
//            memberPurchaseOrdersParams.add(memberPurchaseOrdersParam);
//        }
//        return BoServiceUtils.updateMainBo(ModelConst.T_MEMBER_PURCHASE_ORDER, memberPurchaseOrdersParams);
//    }
//
//    /**
//     * 转采管理-采购订单商品列表分页查询
//     *
//     * @param dto
//     * @return
//     */
//    @Path("transferPurchaseOrderGoodsList")
//    @POST
//    @Operation(summary = "转采管理-采购订单商品列表分页查询", tags = CUSTOM_SERVICE, description = "pageIndex、pageSize必填")
//    public SingleResponse<BOList> transferPurchaseOrderGoodsList(@Parameter MemberPurchaseOrderGoodsDto dto) {
//        log.info("------------------------转采管理-采购订单商品列表分页查询 transferPurchaseOrderGoodsList Param：{}------------------------", JsonUtils.toJson(dto));
//        if (null == dto.getPageIndex() || null == dto.getPageSize()) {
//            return SingleResponse.buildFailure("-1", "pageIndex、pageSize必填");
//        }
//        String mpgTableName = getTableName(ModelConst.T_MEMBER_PURCHASE_ORDER_GOODS);
//        String mpoTableName = getTableName(ModelConst.T_MEMBER_PURCHASE_ORDER);
//        String tosTableName = getTableName(ModelConst.T_TRANSFER_ORDER);
//        String togTableName = getTableName(ModelConst.T_TRANSFER_ORDER_GOODS);
//        Map<String, Object> parameter = new HashMap<>();
//        StringBuilder listSql = new StringBuilder();
//        StringBuilder whereSql = new StringBuilder();
//        StringBuilder countSql = new StringBuilder();
//        listSql.append("select case when mpg.cloud_order_goods_id is null or mpg.cloud_order_goods_id='' then tog.cloud_order_goods_id end as cloud_order_goods_id, " +
//                "case when mpg.cloud_order_id is null or mpg.cloud_order_id='' then tos.cloud_order_id end as cloud_order_id, mpg.*,mpo.*,tog.*,tos.*  from " + mpgTableName + " mpg " +
//                "INNER JOIN " + mpoTableName + " mpo on mpg.member_purchase_order_id = mpo.id " +
//                "LEFT JOIN " + togTableName + " tog on tog.id = mpg.transfer_order_goods_id " +
//                "LEFT JOIN " + tosTableName + " tos on tos.id = tog.transfer_order_id where mpg.deleted = '0' ");
//        countSql.append("select count(*) from " + mpgTableName + " mpg " +
//                "INNER JOIN " + mpoTableName + " mpo on mpg.member_purchase_order_id = mpo.id " +
//                "LEFT JOIN " + togTableName + " tog on tog.id = mpg.transfer_order_goods_id " +
//                "LEFT JOIN " + tosTableName + " tos on tos.id = tog.transfer_order_id where mpg.deleted = '0' ");
//        //云平台订单号
//        if (StringUtils.isNotBlank(dto.getCloud_order_id())) {
//            List<String> ids = StringUtils.stringToListString(dto.getCloud_order_id(), ";");
//            whereSql.append(" and tos.cloud_order_id in (:cloud_order_id) ");
//            parameter.put("cloud_order_id", ids);
//        }
//        //云平台订单商品号
//        if (StringUtils.isNotBlank(dto.getCloud_order_goods_id())) {
//            List<String> ids = StringUtils.stringToListString(dto.getCloud_order_goods_id(), ";");
//            whereSql.append(" and tog.cloud_order_goods_id in (:cloud_order_goods_id) ");
//            parameter.put("cloud_order_goods_id", ids);
//        }
//        //采购P单
//        if (StringUtils.isNotBlank(dto.getPo_code())) {
//            List<String> poCodes = StringUtils.stringToListString(dto.getPo_code(), ";");
//            whereSql.append(" and mpo.po_code in (:po_code) ");
//            parameter.put("po_code", poCodes);
//        }
//        //采购员
//        if (StringUtils.isNotBlank(dto.getBuyer())) {
//            whereSql.append(" and mpo.buyer like :buyer ");
//            parameter.put("buyer", "%" + dto.getBuyer() + "%");
//        }
//        //供应商
//        if (StringUtils.isNotBlank(dto.getVendor_name())) {
//            whereSql.append(" and mpo.vendor_name like :vendor_name ");
//            parameter.put("vendor_name", "%" + dto.getVendor_name() + "%");
//        }
//        //采购单付款状态
//        if (StringUtils.isNotBlank(dto.getMember_purchase_order_status())) {
//            whereSql.append(" and mpo.member_purchase_order_status = :member_purchase_order_status ");
//            parameter.put("member_purchase_order_status", dto.getMember_purchase_goods_status());
//        }
//        //采购单收票状态
//        if (StringUtils.isNotBlank(dto.getInvoice_status())) {
//            whereSql.append(" and mpo.invoice_status = :invoice_status ");
//            parameter.put("invoice_status", dto.getInvoice_status());
//        }
//        //付款方式
//        if (StringUtils.isNotBlank(dto.getPayment_id())) {
//            whereSql.append(" and mpo.payment_id = :payment_id ");
//            parameter.put("payment_id", dto.getPayment_id() );
//        }
//        //发票类型
//        if (StringUtils.isNotBlank(dto.getInvoice_type())) {
//            whereSql.append(" and mpo.invoice_type = :invoice_type ");
//            parameter.put("invoice_type", dto.getInvoice_type());
//        }
//        //商品状态
//        if (StringUtils.isNotBlank(dto.getMember_purchase_goods_status())) {
//            whereSql.append(" and mpg.member_purchase_goods_status = :member_purchase_goods_status ");
//            parameter.put("member_purchase_goods_status", dto.getMember_purchase_goods_status());
//        }
//        //商品名称
//        if (null != dto.getName()) {
//            whereSql.append(" and tog.name like :name ");
//            parameter.put("name", "%" + dto.getName() + "%");
//        }
//        //采购总价（含）
//        if (null != dto.getPurchase_amount()) {
//            whereSql.append(" and mpo.purchase_amount like :purchase_amount ");
//            parameter.put("purchase_amount", "%" + dto.getPurchase_amount() + "%");
//        }
//        //品牌
//        if (StringUtils.isNotBlank(dto.getBrand())) {
//            whereSql.append(" and tog.brand like :brand ");
//            parameter.put("brand", "%" + dto.getBrand() + "%");
//        }
//        //型号
//        if (StringUtils.isNotBlank(dto.getModel())) {
//            whereSql.append(" and tog.model like :model ");
//            parameter.put("model", "%" + dto.getModel() + "%");
//        }
//        //物流单号
//        if (StringUtils.isNotBlank(dto.getLogistics_number())) {
//            whereSql.append(" and tog.name like :name ");
//            parameter.put("name", "%" + dto.getName() + "%");
//        }
//        //供应商回复交期
//        if (StringUtils.isNotBlank(dto.getDelivery_memo())) {
//            whereSql.append(" and tog.delivery_memo like :delivery_memo ");
//            parameter.put("delivery_memo", "%" + dto.getDelivery_memo() + "%");
//        }
//        //采购单日期
//        if (!CollectionUtils.isEmpty(dto.getCreatedTime()) && dto.getCreatedTime().size() >= 2) {
//            whereSql.append(" and tog.createdTime between :startTime and :endTime ");
//            parameter.put("startTime", dto.getCreatedTime().get(0));
//            parameter.put("endTime", dto.getCreatedTime().get(1));
//        }
//        //是否退货
//        if (null != dto.getIs_return() && dto.getIs_return()) {
//            whereSql.append(" and mpo.is_rp = true ");
//        }
//        countSql.append(whereSql);
//        listSql.append(whereSql);
//        listSql.append(" order by mpg.createdTime desc");
//        listSql.append(" limit " + dto.getPageIndex() * dto.getPageSize() + ", " + dto.getPageSize());
//        log.info("------------------------转采管理-采购订单商品列表分页查询 transferPurchaseOrderGoodsList listSql：{}------------------------parameter：{}", listSql, JsonUtils.toJson(parameter));
//        List<Map<String, Object>> resultList = jdbcTemplate.queryForList(listSql.toString(), parameter);
//        Integer count = 0;
//        try {
//            count = jdbcTemplate.queryForObject(countSql.toString(), parameter, Integer.class);
//        } catch (DataAccessException e) {
//            e.printStackTrace();
//        }
//        //构建结果集
//        BoResultFormat.resultFormat(resultList, ModelConst.T_MEMBER_PURCHASE_ORDER_GOODS);
//        BOList bOList = new BOList();
//        bOList.setData(resultList);
//        bOList.setTotal(count);
//        bOList.setSchemaCode(ModelConst.T_MEMBER_PURCHASE_ORDER_GOODS);
//        return SingleResponse.of(bOList);
//    }
//
//    /**
//     * 转采管理-采购订单商品-申请退货
//     *
//     * @param dto
//     * @return
//     */
//    @Path("applyReturn")
//    @POST
//    @Operation(summary = "转采管理-采购订单商品-申请退货", tags = CUSTOM_SERVICE, description = "dto、id、dto.memberPurchaseOrderGoods必填")
//    public SingleResponse<BO> applyReturn(@Parameter MemberPurchaseOrderDto dto) {
//        if (null == dto) {
//            return SingleResponse.buildFailure("-1", "会员采购订单必填");
//        }
//        if (StringUtils.isBlank(dto.getId())) {
//            return SingleResponse.buildFailure("-1", "会员采购订单ID必填");
//        }
//        if (CollectionUtils.isEmpty(dto.getMemberPurchaseOrderGoods())) {
//            return SingleResponse.buildFailure("-1", "会员采购订单商品必填");
//        }
//        return transferOrderService.createMemberPurchaseOrderRefund(dto);
//    }
//
//    /**
//     * 转采管理-采购订单商品-修改备注
//     *
//     * @param dto
//     * @return
//     */
//    @Path("updatePurchaseMemo")
//    @POST
//    @Operation(summary = "转采管理-采购订单商品-修改备注", tags = CUSTOM_SERVICE, description = "id、memo必填")
//    public SingleResponse<BO> updatePurchaseMemo(@Parameter MemberPurchaseOrderDto dto) {
//        if (StringUtils.isBlank(dto.getId())) {
//            return SingleResponse.buildFailure("-1", "会员采购订单ID必填");
//        }
//        if (StringUtils.isBlank(dto.getMemo())) {
//            return SingleResponse.buildFailure("-1", "备注必填");
//        }
//        Map<String, Object> param = new HashMap<>();
//        param.put("id", dto.getId());
//        param.put("memo", dto.getMemo());
//        return BoServiceUtils.updateMainBo(ModelConst.T_MEMBER_PURCHASE_ORDER, param);
//    }
//
//    /**
//     * 转采管理-采购订单商品-维护物流
//     *
//     * @param dto
//     * @return
//     */
//    @Path("updatePurchaseLogistics")
//    @POST
//    @Operation(summary = "转采管理-采购订单商品-维护物流", tags = CUSTOM_SERVICE, description = "id、delivery_number必填，" +
//            "logistics_name、logistics_number、maintenance_logistics_time、maintenance_logistics_user选填")
//    public SingleResponse<BO> updatePurchaseLogistics(@Parameter MemberPurchaseOrderGoodsDto dto) {
//        if (StringUtils.isBlank(dto.getId())) {
//            return SingleResponse.buildFailure("-1", "会员采购订单ID必填");
//        }
//        log.info("-------" + dto.getDelivery_number().compareTo(BigDecimal.ZERO));
//        if (null == dto.getDelivery_number() || dto.getDelivery_number().compareTo(BigDecimal.ZERO) < 1) {
//            return SingleResponse.buildFailure("-1", "发货数量必填,并大于0");
//        }
//        Map<String, Object> param = new HashMap<>();
//        param.put("id", dto.getId());
//        param.put("delivery_number", dto.getDelivery_number());
//        param.put("logistics_name", dto.getLogistics_name());
//        param.put("logistics_number", dto.getLogistics_number());
//        param.put("maintenance_logistics_time", dto.getMaintenance_logistics_time());
//        param.put("maintenance_logistics_user", null == dto.getMaintenance_logistics_user() ? getSelectorFormat() : dto.getMaintenance_logistics_user());
//        return BoServiceUtils.updateMainBo(ModelConst.T_MEMBER_PURCHASE_ORDER_GOODS, param);
//    }
//
//    /**
//     * 转采管理-采购付款-审核
//     *
//     * @param dto
//     * @return
//     */
//    @Path("approvePayment")
//    @POST
//    @Operation(summary = "转采管理-采购付款-审核", tags = CUSTOM_SERVICE, description = "ids、is_pass必填,approve_comments非必填")
//    public SingleResponse<Boolean> approvePayment(@Parameter PurchaseRequestPaymentDto dto) {
//        if (CollectionUtils.isEmpty(dto.getIds())) {
//            return SingleResponse.buildFailure("-1", "采购申请支付ID必填");
//        }
//        if (null == dto.getIs_pass()) {
//            return SingleResponse.buildFailure("-1", "审核是否通过必填");
//        }
//        return SingleResponse.of(transferOrderService.approvePurchaseRequestPayment(dto));
//    }
//
//    /**
//     * 转采管理-采购付款-作废
//     *
//     * @param dto
//     * @return
//     */
//    @Path("disusedPayment")
//    @POST
//    @Operation(summary = "转采管理-采购付款-作废", tags = CUSTOM_SERVICE, description = "ids必填")
//    public SingleResponse<Boolean> disusedPayment(@Parameter PurchaseRequestPaymentDto dto) {
//        if (CollectionUtils.isEmpty(dto.getIds())) {
//            return SingleResponse.buildFailure("-1", "采购申请支付ID必填");
//        }
//        return SingleResponse.of(transferOrderService.abandonPayment(dto.getIds()));
//    }
//
//    /**
//     * 转采管理-采购收票列表分页查询
//     *
//     * @param dto
//     * @return
//     */
//    @Path("purchaseInvoiceList")
//    @POST
//    @Operation(summary = "转采管理-采购订单商品列表分页查询", tags = CUSTOM_SERVICE, description = "pageIndex、pageSize必填")
//    public SingleResponse<BOList> purchaseInvoiceList(@Parameter PurchasePaymentInvoiceDto dto) {
//        log.info("------------------------转采管理-采购订单商品列表分页查询 purchaseInvoiceList Param：{}------------------------", JsonUtils.toJson(dto));
//        if (null == dto.getPageIndex() || null == dto.getPageSize()) {
//            return SingleResponse.buildFailure("-1", "pageIndex、pageSize必填");
//        }
//        String piTableName = getTableName(ModelConst.T_PURCHASE_INVOICE);
//        String pidTableName = getTableName(ModelConst.T_PURCHASE_INVOICE_DETAIL);
//        Map<String, Object> parameter = new HashMap<>();
//        StringBuilder listSql = new StringBuilder();
//        StringBuilder whereSql = new StringBuilder();
//        StringBuilder countSql = new StringBuilder();
//        listSql.append("SELECT pi.*, GROUP_CONCAT(pid.invoice_number) invoice_number\n" +
//                " FROM " + piTableName + " pi\n" +
//                " LEFT JOIN " + pidTableName + " pid ON pid.purchase_invoice_id = pi.id\n" +
//                " WHERE pi.deleted = false");
//        countSql.append("SELECT count(*) \n" +
//                " FROM " + piTableName + " pi\n" +
//                " LEFT JOIN " + pidTableName + " pid ON pid.purchase_invoice_id = pi.id\n" +
//                " WHERE pi.deleted = false");
//        //采购P单
//        if (StringUtils.isNotBlank(dto.getPo_code())) {
//            List<String> poCodes = StringUtils.stringToListString(dto.getPo_code(), ";");
//            whereSql.append(" and pi.po_code in (:po_code) ");
//            parameter.put("po_code", poCodes);
//        }
//        //发票抬头
//        if (StringUtils.isNotBlank(dto.getTitle())) {
//            whereSql.append(" and pi.title like :title ");
//            parameter.put("title", dto.getTitle());
//        }
//        //申请人
//        if (StringUtils.isNotBlank(dto.getApplicant())) {
//            whereSql.append(" and pi.applicant like :applicant ");
//            parameter.put("applicant", dto.getApplicant());
//        }
//        //平台组织名称
//        if (StringUtils.isNotBlank(dto.getPlatform_name())) {
//            whereSql.append(" and pi.platform_name like :platform_name ");
//            parameter.put("platform_name", dto.getPlatform_name());
//        }
//        //采购收票状态
//        if (StringUtils.isNotBlank(dto.getPurchase_invoice_status())) {
//            whereSql.append(" and pi.purchase_invoice_status = :purchase_invoice_status ");
//            parameter.put("purchase_invoice_status", dto.getPurchase_invoice_status());
//        }
//        //采购收票种类
//        if (StringUtils.isNotBlank(dto.getInvoice_type())) {
//            whereSql.append(" and pi.invoice_type = :invoice_type ");
//            parameter.put("invoice_type", dto.getInvoice_type());
//        }
//        //发票号码
//        if (StringUtils.isNotBlank(dto.getInvoice_number())) {
//            whereSql.append(" and pid.invoice_number like :invoice_number ");
//            parameter.put("invoice_type", dto.getInvoice_type());
//        }
//        //收票申请日期
//        if (!CollectionUtils.isEmpty(dto.getCreatedTime()) && dto.getCreatedTime().size() >= 2) {
//            whereSql.append(" and tog.createdTime between :startTime and :endTime ");
//            parameter.put("startTime", dto.getCreatedTime().get(0));
//            parameter.put("endTime", dto.getCreatedTime().get(1));
//        }
//        countSql.append(whereSql);
//        listSql.append(whereSql);
//        listSql.append(" GROUP BY pi.id limit " + dto.getPageIndex() * dto.getPageSize() + ", " + dto.getPageSize());
//        log.info("------------------------转采管理-采购订单商品列表分页查询 purchaseInvoiceList listSql：{}------------------------parameter：{}", listSql, JsonUtils.toJson(parameter));
//        List<Map<String, Object>> resultList = jdbcTemplate.queryForList(listSql.toString(), parameter);
//        Integer count = 0;
//        try {
//            count = jdbcTemplate.queryForObject(countSql.toString(), parameter, Integer.class);
//        } catch (DataAccessException e) {
//            e.printStackTrace();
//        }
//        //构建结果集
//        BoResultFormat.resultFormat(resultList, ModelConst.T_PURCHASE_INVOICE);
//        BOList bOList = new BOList();
//        bOList.setData(resultList);
//        bOList.setTotal(count);
//        bOList.setSchemaCode(ModelConst.T_PURCHASE_INVOICE);
//        return SingleResponse.of(bOList);
//    }
//
//    /**
//     * 转采管理-采购收票-提交财务/转采管理-采购收票-取消收票
//     *
//     * @param dto
//     * @return
//     */
//    @Path("cancelOrConfirmInvoice")
//    @POST
//    @Operation(summary = "转采管理-采购收票-提交财务/转采管理-采购收票-取消收票", tags = CUSTOM_SERVICE, description = "ids、type必填，取消收票为1;提交财务为4")
//    public SingleResponse<Boolean> cancelOrConfirmInvoice(@Parameter PurchaseInvoiceDto dto) {
//        return SingleResponse.of(transferOrderService.invoiceCancelOrConfirm(dto.getIds(), dto.getType(), null));
//    }
//
//    /**
//     * 转采管理-采购收票-修改发票
//     *
//     * @param dto
//     * @return
//     */
//    @Path("updateInvoice")
//    @POST
//    @Operation(summary = "转采管理-采购收票-修改发票-采购收票修改", tags = CUSTOM_SERVICE, description = "id、" +
//            "purchaseInvoiceDetails.id、purchaseInvoiceDetails.invoice_number、purchaseInvoiceDetails.invoice_time")
//    public SingleResponse<BO> updateInvoice(@Parameter PurchaseInvoiceDto dto) {
//        if (StringUtils.isBlank(dto.getId())) {
//            return SingleResponse.buildFailure("-1", "采购收票ID必填");
//        }
//        if (CollectionUtils.isEmpty(dto.getPurchaseInvoiceDetails())) {
//            return SingleResponse.buildFailure("-1", "采购收票明细必填");
//        }
//        for (PurchaseInvoiceDetailDto purchaseInvoiceDetail : dto.getPurchaseInvoiceDetails()) {
//            if (StringUtils.isBlank(purchaseInvoiceDetail.getId())) {
//                return SingleResponse.buildFailure("-1", "采购收票明细ID必填");
//            }
//            if (StringUtils.isBlank(purchaseInvoiceDetail.getInvoice_number())) {
//                return SingleResponse.buildFailure("-1", "采购收票明细发票号码必填");
//            }
//            if (StringUtils.isBlank(purchaseInvoiceDetail.getInvoice_time())) {
//                return SingleResponse.buildFailure("-1", "采购收票明细采购收票时间必填");
//            }
//        }
//        return transferOrderService.updatePurchaseInvoice(dto);
//    }
//
//    /**
//     * 转采管理-采购订单-修改订单-通过采购订单ID查询采购订单商品数据
//     *
//     * @param dto
//     * @return
//     */
//    @Path("purchaseGoodsFindByPurchaseId")
//    @POST
//    @Operation(summary = "转采管理-采购订单-修改订单-通过采购订单ID查询采购订单商品数据", tags = CUSTOM_SERVICE, description = "id必填")
//    public SingleResponse<BO> purchaseGoodsFindByPurchaseId(@Parameter MemberPurchaseOrderDto dto) {
//        return transferOrderService.purchaseGoodsFindByPurchase(dto);
//    }
//
//    /**
//     * 转采管理-转采客户订单-导出列表
//     *
//     * @param bo
//     * @return
//     */
//    @Path("exporOrderCustomer")
//    @POST
//    @Operation(summary = "转采管理-转采客户订单-导出列表", tags = CUSTOM_SERVICE, description = "入参:{data:{ids:[],fileType:'pdf/xlsx'}}")
//    public SingleResponse exporOrderCustomer(SaveOrUpdateBO bo) {
//        List<String> ids = (List<String>) bo.getData().get("ids");
//        if (ObjectUtils.isEmpty(ids)) {
//            return SingleResponse.buildFailure("-1", "请求参数ids不能为空");
//        }
//
//        String fileType = (String) bo.getData().get("fileType");
//        ReportType reportType = ReportType.get(fileType);
//
//        if (reportType == null) {
//            return SingleResponse.buildFailure("-1", "请求参数fileType不能为空");
//        }
//
//        SingleResponse<BOList> singleResponse = BoQueryUtils.Builder(ModelConst.T_TRANSFER_ORDER)
//                .condition()
//                .in("id", ids)
//                .End().listBO();
//        if (!singleResponse.isSuccess()) {
//            return singleResponse;
//        }
//        List<Map<String, Object>> data = singleResponse.getData().getData();
//
//        if (data.isEmpty()) {
//            return SingleResponse.buildFailure("-1", "未获取到下载数据");
//        }
//
//        String exportField = "{\"id\":\"id\",\"time\":\"createdTime\",\"total\":\"total\",\"amount\":\"amount\",\"receiver\":\"receiver\",\"phone\":\"phone\",\"postal\":\"postal\",\"address\":\"address\",\"memberName\":\"user_name\",\"orgName\":\"organization_name\",\"cloudOrderId\":\"cloud_order_id\"}";
//        JSONObject exportJson = JSON.parseObject(exportField);
//        List<Map<String, Object>> fileData = data.stream().map(m -> {
//            Map<String, Object> mf = new HashMap<>();
//            for (String key : exportJson.keySet()) {
//                mf.put(exportJson.getString(key), m.get(key));
//            }
//            return mf;
//        }).collect(Collectors.toList());
//
//
//        if (log.isDebugEnabled()) {
//            log.debug("======================转采管理-转采客户订单-导出参数:reportType={},fileData={}", reportType.getId(), JSON.toJSONString(fileData));
//        }
//        ReportUtils.exportReport("purchase/transfer_order_report.jrxml", reportType.getId(), fileData);
//
//        return SingleResponse.buildSuccess();
//    }
//
//
//    /**
//     * 转采管理-转采客户订单商品-导出列表
//     *
//     * @param bo
//     * @return
//     */
//    @Path("exporTransferOrderGoodsReport")
//    @POST
//    @Operation(summary = "转采管理-转采客户订单商品-导出列表", tags = CUSTOM_SERVICE, description = "入参:{data:{ids:[],fileType:'pdf/xlsx'}}")
//    public SingleResponse exporTransferOrderGoodsReport(SaveOrUpdateBO bo) {
//        List<String> ids = (List<String>) bo.getData().get("ids");
//        if (ObjectUtils.isEmpty(ids)) {
//            return SingleResponse.buildFailure("-1", "请求参数ids不能为空");
//        }
//
//        String fileType = (String) bo.getData().get("fileType");
//        ReportType reportType = ReportType.get(fileType);
//
//        if (reportType == null) {
//            return SingleResponse.buildFailure("-1", "请求参数fileType不能为空");
//        }
//
//        SingleResponse<BOList> singleResponse = BoQueryUtils.Builder(ModelConst.T_TRANSFER_ORDER_GOODS)
//                .condition()
//                .in("id", ids)
//                .End().listBO();
//        if (!singleResponse.isSuccess()) {
//            return singleResponse;
//        }
//        List<Map<String, Object>> data = singleResponse.getData().getData();
//
//        if (data.isEmpty()) {
//            return SingleResponse.buildFailure("-1", "未获取到下载数据");
//        }
//
//        String exportField = "{\"time\":\"createdTime\",\"brand\":\"brand\",\"name\":\"name\",\"model\":\"model\",\"spec\":\"spec\",\"sku\":\"sku\",\"memo\":\"memo\",\"unit\":\"unit\",\"delivery\":\"delivery\",\"num\":\"num\",\"taxRate\":\"tax_rate\",\"price\":\"price\",\"amount\":\"amount\",\"status\":\"transfer_order_goods_status\",\"cloudOrderGoodsId\":\"cloud_order_goods_id\",\"vendorName\":\"vendor_name\",\"transferOrderId\":\"transfer_order_id\",\"cloudOrderId\":\"cloud_order_id\",\"customerName\":\"user_name\",\"inquiryId\":\"inquiry_id\"}";
//        JSONObject exportJson = JSON.parseObject(exportField);
//        List<Map<String, Object>> fileData = data.stream().map(m -> {
//            Map<String, Object> mf = new HashMap<>();
//            for (String key : exportJson.keySet()) {
//                mf.put(exportJson.getString(key), m.get(key));
//            }
//            return mf;
//        }).collect(Collectors.toList());
//
//
//        if (log.isDebugEnabled()) {
//            log.debug("======================转采管理-转采客户订单-导出参数:reportType={},fileData={}", reportType.getId(), JSON.toJSONString(fileData));
//        }
//        ReportUtils.exportReport("purchase/transfer_order_goods_report.jrxml", reportType.getId(), fileData);
//
//        return SingleResponse.buildSuccess();
//    }
//
//    /**
//     * 转采管理-采购订单-导出列表
//     *
//     * @param bo
//     * @return
//     */
//    @Path("exporPurchaseOrderReport")
//    @POST
//    @Operation(summary = "转采管理-采购订单-导出列表", tags = CUSTOM_SERVICE, description = "入参:{data:{ids:[],fileType:'pdf/xlsx'}}")
//    public SingleResponse exporPurchaseOrderReport(SaveOrUpdateBO bo) {
//        List<String> ids = (List<String>) bo.getData().get("ids");
//        if (ObjectUtils.isEmpty(ids)) {
//            return SingleResponse.buildFailure("-1", "请求参数ids不能为空");
//        }
//
//        String fileType = (String) bo.getData().get("fileType");
//        ReportType reportType = ReportType.get(fileType);
//
//        if (reportType == null) {
//            return SingleResponse.buildFailure("-1", "请求参数fileType不能为空");
//        }
//
//        SingleResponse<BOList> singleResponse = BoQueryUtils.Builder(ModelConst.T_MEMBER_PURCHASE_ORDER)
//                .condition()
//                .in("id", ids)
//                .End().listBO();
//        if (!singleResponse.isSuccess()) {
//            return singleResponse;
//        }
//        List<Map<String, Object>> data = singleResponse.getData().getData();
//
//        if (data.isEmpty()) {
//            return SingleResponse.buildFailure("-1", "未获取到下载数据");
//        }
//
//        String exportField = "{\"id\":\"id\",\"poCode\":\"po_code\",\"status\":\"member_purchase_order_status\",\"invoiceStatus\":\"invoice_status\",\"purchaseAmount\":\"purchase_amount\",\"noPaymentAmount\":\"no_payment_amount\",\"paymentName\":\"payment_name\",\"invoiceRate\":\"invoice_rate\",\"transferVendorName\":\"vendor_name\",\"memo\":\"memo\",\"time\":\"createdTime\",\"buyer\":\"buyer\",\"cloudOrderIds\":\"cloud_order_ids\",\"customerName\":\"customer_name\"}";
//        JSONObject exportJson = JSON.parseObject(exportField);
//        List<Map<String, Object>> fileData = data.stream().map(m -> {
//            Map<String, Object> mf = new HashMap<>();
//            for (String key : exportJson.keySet()) {
//                mf.put(exportJson.getString(key), m.get(key));
//            }
//            return mf;
//        }).collect(Collectors.toList());
//
//
//        if (log.isDebugEnabled()) {
//            log.debug("======================转采管理-转采客户订单-导出参数:reportType={},fileData={}", reportType.getId(), JSON.toJSONString(fileData));
//        }
//        ReportUtils.exportReport("purchase/purchase_order_report.jrxml", reportType.getId(), fileData);
//
//        return SingleResponse.buildSuccess();
//    }
//
//    /**
//     * 转采管理-采购订单-打印采购单
//     *
//     * @param bo
//     * @return
//     */
//    @Path("printPurchaseOrderReport")
//    @POST
//    @Operation(summary = "转采管理-采购订单-打印采购单", tags = CUSTOM_SERVICE, description = "入参:{data:{ids:[],fileType:'pdf/xlsx'}}")
//    public SingleResponse printPurchaseOrderReport(SaveOrUpdateBO bo) {
//        List<String> ids = (List<String>) bo.getData().get("ids");
//        if (ObjectUtils.isEmpty(ids)) {
//            return SingleResponse.buildFailure("-1", "请求参数ids不能为空");
//        }
//
//        String fileType = (String) bo.getData().get("fileType");
//        ReportType reportType = ReportType.get(fileType);
//
//        if (reportType == null) {
//            return SingleResponse.buildFailure("-1", "请求参数fileType不能为空");
//        }
//        String mpgTableName = getTableName(ModelConst.T_MEMBER_PURCHASE_ORDER_GOODS);
//        String mpoTableName = getTableName(ModelConst.T_MEMBER_PURCHASE_ORDER);
//        String tosTableName = getTableName(ModelConst.T_TRANSFER_ORDER);
//        String togTableName = getTableName(ModelConst.T_TRANSFER_ORDER_GOODS);
//        Map<String, Object> parameter = new HashMap<>();
//        StringBuilder listSql = new StringBuilder();
//        StringBuilder whereSql = new StringBuilder();
//        listSql.append("select case when mpg.cloud_order_goods_id is null or mpg.cloud_order_goods_id='' then tog.cloud_order_goods_id end as cloud_order_goods_id, " +
//                "case when mpg.cloud_order_id is null or mpg.cloud_order_id='' then tos.cloud_order_id end as cloud_order_id, mpg.*,mpo.*,tog.*,tos.*  from " + mpgTableName + " mpg " +
//                "INNER JOIN " + mpoTableName + " mpo on mpg.member_purchase_order_id = mpo.id " +
//                "LEFT JOIN " + togTableName + " tog on tog.id = mpg.transfer_order_goods_id " +
//                "LEFT JOIN " + tosTableName + " tos on tos.id = tog.transfer_order_id where mpg.deleted = '0' ");
//        //云平台订单号
//        whereSql.append(" and tos.cloud_order_id in (:cloud_order_id) ");
//        parameter.put("cloud_order_id", ids);
//        listSql.append(whereSql);
//        listSql.append(" order by mpg.createdTime desc");
//        log.info("------------------------转采管理-采购订单-打印采购单 printPurchaseOrderReport listSql：{}------------------------parameter：{}", listSql, JsonUtils.toJson(parameter));
//        List<Map<String, Object>> data = jdbcTemplate.queryForList(listSql.toString(), parameter);
//
//        if (data.isEmpty()) {
//            return SingleResponse.buildFailure("-1", "未获取到下载数据");
//        }
//
//        String exportField = "{\"fullName\":\"full_name\",\"id\":\"id\",\"brand\":\"brand\",\"name\":\"name\",\"unit\":\"unit\",\"amount\":\"amount\",\"time\":\"createdTime\",\"num\":\"num\",\"price\":\"price\",\"poCode\":\"po_code\",\"cloudOrderIds\":\"cloud_order_ids\",\"vendorName\":\"vendor_name\",\"transferVendorContacts\":\"transfer_order_ids\",\"transferVendorMobile\":\"phone\",\"transferVendorEmail\":\"email\",\"mobile\":\"phone\",\"email\":\"email\",\"cloudOrderId\":\"cloud_order_id\",\"modelAndSpec\":\"model\",\"invoiceRate\":\"invoice_rate\",\"memo\":\"memo\",\"deliveryTime\":\"delivery_time\",\"receiveMessage\":\"receiver\",\"paymentName\":\"payment_name\",\"preAmount\":\"pre_amount\"}";
//        JSONObject exportJson = JSON.parseObject(exportField);
//        List<Map<String, Object>> fileData = data.stream().map(m -> {
//            Map<String, Object> mf = new HashMap<>();
//            for (String key : exportJson.keySet()) {
//                mf.put(exportJson.getString(key), m.get(key));
//            }
//            return mf;
//        }).collect(Collectors.toList());
//
//
//        if (log.isDebugEnabled()) {
//            log.debug("======================转采管理-采购订单-打印采购单:reportType={},fileData={}", reportType.getId(), JSON.toJSONString(fileData));
//        }
//        ReportUtils.exportReport("purchase/purchase_order_print_report.jrxml", reportType.getId(), fileData);
//
//        return SingleResponse.buildSuccess();
//    }
//
//
//    /**
//     * 转采管理-采购订单商品-导出列表
//     *
//     * @param bo
//     * @return
//     */
//    @Path("exporPurchaseOrderGoodsReport")
//    @POST
//    @Operation(summary = "转采管理-采购订单商品-导出列表", tags = CUSTOM_SERVICE, description = "入参:{data:{ids:[],fileType:'pdf/xlsx'}}")
//    public SingleResponse exporPurchaseOrderGoodsReport(SaveOrUpdateBO bo) {
//        List<String> ids = (List<String>) bo.getData().get("ids");
//        if (ObjectUtils.isEmpty(ids)) {
//            return SingleResponse.buildFailure("-1", "请求参数ids不能为空");
//        }
//
//        String fileType = (String) bo.getData().get("fileType");
//        ReportType reportType = ReportType.get(fileType);
//
//        if (reportType == null) {
//            return SingleResponse.buildFailure("-1", "请求参数fileType不能为空");
//        }
//
//        String mpgTableName = getTableName(ModelConst.T_MEMBER_PURCHASE_ORDER_GOODS);
//        String mpoTableName = getTableName(ModelConst.T_MEMBER_PURCHASE_ORDER);
//        String tosTableName = getTableName(ModelConst.T_TRANSFER_ORDER);
//        String togTableName = getTableName(ModelConst.T_TRANSFER_ORDER_GOODS);
//        Map<String, Object> parameter = new HashMap<>();
//        StringBuilder listSql = new StringBuilder();
//        StringBuilder whereSql = new StringBuilder();
//        listSql.append("select case when mpg.cloud_order_goods_id is null or mpg.cloud_order_goods_id='' then tog.cloud_order_goods_id end as cloud_order_goods_id, " +
//                "case when mpg.cloud_order_id is null or mpg.cloud_order_id='' then tos.cloud_order_id end as cloud_order_id, mpg.*,mpo.*,tog.*,tos.*  from " + mpgTableName + " mpg " +
//                "INNER JOIN " + mpoTableName + " mpo on mpg.member_purchase_order_id = mpo.id " +
//                "LEFT JOIN " + togTableName + " tog on tog.id = mpg.transfer_order_goods_id " +
//                "LEFT JOIN " + tosTableName + " tos on tos.id = tog.transfer_order_id where mpg.deleted = '0' ");
//        //云平台订单号
//        whereSql.append(" and tos.cloud_order_id in (:cloud_order_id) ");
//        parameter.put("cloud_order_id", ids);
//        listSql.append(whereSql);
//        listSql.append(" order by mpg.createdTime desc");
//        log.info("------------------------转采管理-采购订单商品列表分页查询 transferPurchaseOrderGoodsList listSql：{}------------------------parameter：{}", listSql, JsonUtils.toJson(parameter));
//        List<Map<String, Object>> data = jdbcTemplate.queryForList(listSql.toString(), parameter);
//
//        if (data.isEmpty()) {
//            return SingleResponse.buildFailure("-1", "未获取到下载数据");
//        }
//        String exportField = "{\"time\":\"createdTime\",\"brand\":\"brand\",\"name\":\"name\",\"model\":\"model\",\"spec\":\"spec\",\"memo\":\"memo\",\"unit\":\"unit\",\"num\":\"num\",\"price\":\"price\",\"amount\":\"amount\",\"vendorName\":\"vendor_name\",\"paymentName\":\"payment_name\",\"purchaseCode\":\"po_code\",\"purchaseAmount\":\"purchase_amount\",\"purchaseOrderSaleAmount\":\"sale_amount\",\"transferPrice\":\"sale_price\",\"transferNum\":\"sale_num\",\"transferAmount\":\"sale_pre_amount\",\"transferVendorName\":\"vendor_name\",\"orderStatus\":\"member_purchase_order_status\",\"invoiceStatus\":\"invoice_status\",\"buyer\":\"buyer\",\"orgName\":\"organization_name\",\"purchaseRate\":\"tax_rate\",\"deliveryTime\":\"delivery_time\",\"cloudOrderId\":\"cloud_order_id\",\"returnNumber\":\"return_number\",\"cloudOrderGoodsStatus\":\"transfer_order_goods_status\",\"invoiceType\":\"invoice_type\",\"cloudOrderGoodsId\":\"cloud_order_goods_id\"}";
//        JSONObject exportJson = JSON.parseObject(exportField);
//        List<Map<String, Object>> fileData = data.stream().map(m -> {
//            Map<String, Object> mf = new HashMap<>();
//            for (String key : exportJson.keySet()) {
//                mf.put(exportJson.getString(key), m.get(key));
//            }
//            return mf;
//        }).collect(Collectors.toList());
//
//
//        if (log.isDebugEnabled()) {
//            log.debug("======================转采管理-采购订单商品-导出参数:reportType={},fileData={}", reportType.getId(), JSON.toJSONString(fileData));
//        }
//        ReportUtils.exportReport("purchase/purchase_order_goods_report.jrxml", reportType.getId(), fileData);
//
//        return SingleResponse.buildSuccess();
//    }
//
//    /**
//     * 转采管理-采购付款-导出列表
//     *
//     * @param bo
//     * @return
//     */
//    @Path("exporPurchasePaymentReport")
//    @POST
//    @Operation(summary = "转采管理-采购付款-导出列表", tags = CUSTOM_SERVICE, description = "入参:{data:{ids:[],fileType:'pdf/xlsx'}}")
//    public SingleResponse exporPurchasePaymentReport(SaveOrUpdateBO bo) {
//        List<String> ids = (List<String>) bo.getData().get("ids");
//        if (ObjectUtils.isEmpty(ids)) {
//            return SingleResponse.buildFailure("-1", "请求参数ids不能为空");
//        }
//
//        String fileType = (String) bo.getData().get("fileType");
//        ReportType reportType = ReportType.get(fileType);
//
//        if (reportType == null) {
//            return SingleResponse.buildFailure("-1", "请求参数fileType不能为空");
//        }
//
//        String mpgTableName = getTableName(ModelConst.T_PURCHASE_REQUEST_PAYMENT_DETAIL);
//        String mpoTableName = getTableName(ModelConst.T_PURCHASE_REQUEST_PAYMENT);
//        String tosTableName = getTableName(ModelConst.T_MEMBER_PURCHASE_ORDER);
//        Map<String, Object> parameter = new HashMap<>();
//        StringBuilder listSql = new StringBuilder();
//        StringBuilder whereSql = new StringBuilder();
//        listSql.append("select mpg.id, " +
//                "mpg.*,mpo.*,tos.*  from " + mpgTableName + " mpg " +
//                "INNER JOIN " + mpoTableName + " mpo on mpg.payment_id = mpo.id " +
//                "LEFT JOIN " + tosTableName + " tos on mpg.member_purchase_order_id = tos.id where mpg.deleted = '0' ");
//        //云平台订单号
//        whereSql.append(" and mpg.id in (:id) ");
//        parameter.put("id", ids);
//        listSql.append(whereSql);
//        listSql.append(" order by mpg.createdTime desc");
//        log.info("------------------------转采管理-采购付款-导出列表 exporPurchasePaymentReport listSql：{}------------------------parameter：{}", listSql, JsonUtils.toJson(parameter));
//        List<Map<String, Object>> data = jdbcTemplate.queryForList(listSql.toString(), parameter);
//
//        if (data.isEmpty()) {
//            return SingleResponse.buildFailure("-1", "未获取到下载数据");
//        }
//
//        String exportField = "{\"time\":\"createdTime\",\"memo\":\"memo\",\"status\":\"payment_detail_status\",\"poCode\":\"po_code\",\"payment\":\"payment\",\"vendorName\":\"vendor_name\",\"rate\":\"invoice_rate\",\"vendorBank\":\"bank\",\"accountNumber\":\"bank_number\",\"paymentName\":\"payment_name\",\"applicantName\":\"full_name\",\"paymentId\":\"payment_id\",\"cloudOrderIds\":\"cloud_order_ids\",\"buyer\":\"buyer\",\"payName\":\"customer_name\"}";
//        JSONObject exportJson = JSON.parseObject(exportField);
//        List<Map<String, Object>> fileData = data.stream().map(m -> {
//            Map<String, Object> mf = new HashMap<>();
//            for (String key : exportJson.keySet()) {
//                mf.put(exportJson.getString(key), m.get(key));
//            }
//            return mf;
//        }).collect(Collectors.toList());
//
//
//        if (log.isDebugEnabled()) {
//            log.debug("======================转采管理-采购付款-导出参数:reportType={},fileData={}", reportType.getId(), JSON.toJSONString(fileData));
//        }
//        ReportUtils.exportReport("purchase/purchase_payment_report.jrxml", reportType.getId(), fileData);
//
//        return SingleResponse.buildSuccess();
//    }
//
//    /**
//     * 转采管理-采购付款-打印付款单
//     *
//     * @param bo
//     * @return
//     */
//    @Path("printPaymentReport")
//    @POST
//    @Operation(summary = "转采管理-采购付款-打印付款单", tags = CUSTOM_SERVICE, description = "入参:{data:{ids:[],fileType:'pdf/xlsx'}}")
//    public SingleResponse printPaymentReport(SaveOrUpdateBO bo) {
//        List<String> ids = (List<String>) bo.getData().get("ids");
//        if (ObjectUtils.isEmpty(ids)) {
//            return SingleResponse.buildFailure("-1", "请求参数ids不能为空");
//        }
//
//        String fileType = (String) bo.getData().get("fileType");
//        ReportType reportType = ReportType.get(fileType);
//
//        if (reportType == null) {
//            return SingleResponse.buildFailure("-1", "请求参数fileType不能为空");
//        }
//        String mpgTableName = getTableName(ModelConst.T_PURCHASE_REQUEST_PAYMENT);
//        String mpoTableName = getTableName(ModelConst.T_PURCHASE_REQUEST_PAYMENT_DETAIL);
//        String tosTableName = getTableName(ModelConst.T_MEMBER_PURCHASE_ORDER);
//        Map<String, Object> parameter = new HashMap<>();
//        StringBuilder listSql = new StringBuilder();
//        StringBuilder whereSql = new StringBuilder();
//        listSql.append("select mpg.id, " +
//                "mpg.*,mpo.id as detail_id,mpo.*,tos.*  from " + mpgTableName + " mpg " +
//                "INNER JOIN " + mpoTableName + " mpo on mpo.payment_id = mpg.id " +
//                "LEFT JOIN " + tosTableName + " tos on mpo.member_purchase_order_id = tos.id where mpg.deleted = '0' ");
//        //云平台订单号
//        whereSql.append(" and mpg.id in (:id) ");
//        parameter.put("id", ids);
//        listSql.append(whereSql);
//        listSql.append(" order by mpg.createdTime desc");
//        log.info("------------------------转采管理-采购付款-打印付款单 printPaymentReport listSql：{}------------------------parameter：{}", listSql, JsonUtils.toJson(parameter));
//        List<Map<String, Object>> data = jdbcTemplate.queryForList(listSql.toString(), parameter);
//
//        if (data.isEmpty()) {
//            return SingleResponse.buildFailure("-1", "未获取到下载数据");
//        }
//
//        String exportField = "{\"applyName\":\"full_name\",\"time\":\"createdTime\",\"vendorName\":\"vendor_name\",\"bank\":\"bank\",\"memo\":\"memo\",\"detailId\":\"detail_id\",\"poCode\":\"po_code\",\"customerOrderId\":\"member_purchase_order_id\",\"customerName\":\"customer_name\",\"saleAmount\":\"sale_amount\",\"purchaseAmount\":\"purchase_amount\",\"bankAccountNumber\":\"bank_number\",\"payment\":\"payment\",\"grossProfitMargin\":\"gross_profit_margin\",\"printCounter\":\"print_counter\",\"id\":\"id\",\"platformName\":\"platform_name\"}";
//        JSONObject exportJson = JSON.parseObject(exportField);
//        List<Map<String, Object>> fileData = data.stream().map(m -> {
//            Map<String, Object> mf = new HashMap<>();
//            for (String key : exportJson.keySet()) {
//                mf.put(exportJson.getString(key), m.get(key));
//            }
//            return mf;
//        }).collect(Collectors.toList());
//
//
//        if (log.isDebugEnabled()) {
//            log.debug("======================转采管理-采购付款-打印付款单:reportType={},fileData={}", reportType.getId(), JSON.toJSONString(fileData));
//        }
//        ReportUtils.exportReport("purchase/print_payment_report.jrxml", reportType.getId(), fileData);
//
//        return SingleResponse.buildSuccess();
//    }
//
//    /**
//     * 转采管理-采购收票-导出列表
//     *
//     * @param bo
//     * @return
//     */
//    @Path("exporPurchaseInvoiceReport")
//    @POST
//    @Operation(summary = "转采管理-采购收票-导出列表", tags = CUSTOM_SERVICE, description = "入参:{data:{ids:[],fileType:'pdf/xlsx'}}")
//    public SingleResponse exporPurchaseInvoiceReport(SaveOrUpdateBO bo) {
//        List<String> ids = (List<String>) bo.getData().get("ids");
//        if (ObjectUtils.isEmpty(ids)) {
//            return SingleResponse.buildFailure("-1", "请求参数ids不能为空");
//        }
//
//        String fileType = (String) bo.getData().get("fileType");
//        ReportType reportType = ReportType.get(fileType);
//
//        if (reportType == null) {
//            return SingleResponse.buildFailure("-1", "请求参数fileType不能为空");
//        }
//
//        String mpgTableName = getTableName(ModelConst.T_PURCHASE_INVOICE);
//        String mpoTableName = getTableName(ModelConst.T_PURCHASE_INVOICE_DETAIL);
//        Map<String, Object> parameter = new HashMap<>();
//        StringBuilder listSql = new StringBuilder();
//        StringBuilder whereSql = new StringBuilder();
//        listSql.append("select mpg.id, " +
//                "mpg.*,tos.*  from " + mpgTableName + " mpg " +
//                "LEFT JOIN " + mpoTableName + " tos on mpg.id = tos.purchase_invoice_id where mpg.deleted = '0' ");
//        //云平台订单号
//        whereSql.append(" and mpg.id in (:id) ");
//        parameter.put("id", ids);
//        listSql.append(whereSql);
//        listSql.append(" order by mpg.createdTime desc");
//        log.info("------------------------转采管理-采购收票-导出列表 exporPurchasePaymentReport listSql：{}------------------------parameter：{}", listSql, JsonUtils.toJson(parameter));
//        List<Map<String, Object>> data = jdbcTemplate.queryForList(listSql.toString(), parameter);
//
//        if (data.isEmpty()) {
//            return SingleResponse.buildFailure("-1", "未获取到下载数据");
//        }
//
//        String exportField = "{\"time\":\"createdTime\",\"memo\":\"memo\",\"status\":\"purchase_invoice_status\",\"poCode\":\"po_code\",\"purchaseAmount\":\"purchase_amount\",\"applier\":\"applicant\",\"invoiceAmount\":\"invoice_amount\",\"invoiceTitle\":\"title\",\"invoiceNumber\":\"invoice_number\",\"invoicePrice\":\"invoice_price\",\"invoiceRate\":\"invoice_rate\",\"invoiceTime\":\"invoice_time\",\"financialConfirmer\":\"financial_confirmer\",\"financialConfirmerTime\":\"financial_confirm_time\",\"invoiceId\":\"id\"}";
//        JSONObject exportJson = JSON.parseObject(exportField);
//        List<Map<String, Object>> fileData = data.stream().map(m -> {
//            Map<String, Object> mf = new HashMap<>();
//            for (String key : exportJson.keySet()) {
//                mf.put(exportJson.getString(key), m.get(key));
//            }
//            return mf;
//        }).collect(Collectors.toList());
//
//
//        if (log.isDebugEnabled()) {
//            log.debug("======================转采管理-采购收票-导出参数:reportType={},fileData={}", reportType.getId(), JSON.toJSONString(fileData));
//        }
//        ReportUtils.exportReport("purchase/purchase_invoice_report.jrxml", reportType.getId(), fileData);
//
//        return SingleResponse.buildSuccess();
//    }
//
//
//    /**
//     * 转采管理-采购订单明细-打印采购合同
//     *
//     * @param bo
//     * @return
//     */
//    @Path("exporPurchaseOrderPrintReport")
//    @POST
//    @Operation(summary = "转采管理-采购订单明细-打印采购合同", tags = CUSTOM_SERVICE, description = "入参:{data:{ids:[],fileType:'pdf/xlsx'}}")
//    public SingleResponse exporPurchaseOrderPrintReport(SaveOrUpdateBO bo) {
//        List<String> ids = (List<String>) bo.getData().get("ids");
//        if (ObjectUtils.isEmpty(ids)) {
//            return SingleResponse.buildFailure("-1", "请求参数ids不能为空");
//        }
//
//        String fileType = (String) bo.getData().get("fileType");
//        ReportType reportType = ReportType.get(fileType);
//
//        if (reportType == null) {
//            return SingleResponse.buildFailure("-1", "请求参数fileType不能为空");
//        }
//
//        String mpgTableName = getTableName(ModelConst.T_MEMBER_PURCHASE_ORDER_GOODS);
//        String mpoTableName = getTableName(ModelConst.T_MEMBER_PURCHASE_ORDER);
//        String togTableName = getTableName(ModelConst.T_TRANSFER_ORDER_GOODS);
//        String tosTableName = getTableName(ModelConst.T_TRANSFER_ORDER);
////        String tovTableName = getTableName(ModelConst.T_TRANSFER_VENDOR);
//        Map<String, Object> parameter = new HashMap<>();
//        StringBuilder listSql = new StringBuilder();
//        StringBuilder whereSql = new StringBuilder();
//        listSql.append("select " +
//                "case when mpg.cloud_order_id is null or mpg.cloud_order_id='' then tos.cloud_order_id end as cloud_order_id, mpg.*,mpo.*,tog.*,tos.*  from " + mpgTableName + " mpg " +
//                "INNER JOIN " + mpoTableName + " mpo on mpg.member_purchase_order_id = mpo.id " +
//                "LEFT JOIN " + togTableName + " tog on tog.id = mpg.transfer_order_goods_id " +
//                "LEFT JOIN " + tosTableName + " tos on tos.id = tog.transfer_order_id " +
////                "LEFT JOIN " + tovTableName + " tov on tov.id = mpo.vendor_id " +
//                "where mpg.deleted = '0' ");
//        //云平台订单号
//        whereSql.append(" and mpg.id in (:id) ");
//        parameter.put("id", ids);
//        listSql.append(whereSql);
//        listSql.append(" order by mpg.createdTime desc");
//        log.info("------------------------转采管理-采购订单商品列表分页查询 transferPurchaseOrderGoodsList listSql：{}------------------------parameter：{}", listSql, JsonUtils.toJson(parameter));
//        List<Map<String, Object>> data = jdbcTemplate.queryForList(listSql.toString(), parameter);
//
//        if (data.isEmpty()) {
//            return SingleResponse.buildFailure("-1", "未获取到下载数据");
//        }
//
//        String exportField = "{\"fullName\":\"vendor_name\",\"id\":\"id\",\"brand\":\"brand\",\"name\":\"name\",\"unit\":\"unit\",\"amount\":\"amount\",\"time\":\"createdTime\",\"num\":\"num\",\"price\":\"price\",\"poCode\":\"po_code\",\"cloudOrderIds\":\"cloud_order_ids\",\"vendorName\":\"vendor_name\",\"transferVendorContacts\":\"transfer_order_ids\",\"transferVendorMobile\":\"phone\",\"transferVendorEmail\":\"email\",\"mobile\":\"phone\",\"email\":\"email\",\"cloudOrderId\":\"cloud_order_id\",\"modelAndSpec\":\"model\",\"invoiceRate\":\"invoice_rate\",\"memo\":\"memo\",\"deliveryTime\":\"delivery_time\",\"receiveMessage\":\"receiver\",\"paymentName\":\"payment_name\",\"preAmount\":\"pre_amount\"}";
//        JSONObject exportJson = JSON.parseObject(exportField);
//        List<Map<String, Object>> fileData = data.stream().map(m -> {
//            Map<String, Object> mf = new HashMap<>();
//            for (String key : exportJson.keySet()) {
//                mf.put(exportJson.getString(key), m.get(key));
//            }
//            return mf;
//        }).collect(Collectors.toList());
//
//
//        if (log.isDebugEnabled()) {
//            log.debug("======================转采管理-采购订单明细-打印采购合同:reportType={},fileData={}", reportType.getId(), JSON.toJSONString(fileData));
//        }
//        ReportUtils.exportReport("purchase/purchase_order_print_report.jrxml", reportType.getId(), fileData);
//
//        return SingleResponse.buildSuccess();
//    }
//
//    /**
//     * 转采管理-采购订单明细-打印收票单
//     *
//     * @param bo
//     * @return
//     */
//    @Path("exporPurchaseInvoicePrint")
//    @POST
//    @Operation(summary = "转采管理-采购收票明细-打印收票单", tags = CUSTOM_SERVICE, description = "入参:{data:{ids:[],fileType:'pdf/xlsx'}}")
//    public SingleResponse exporPurchaseInvoicePrint(SaveOrUpdateBO bo) {
//        List<String> ids = (List<String>) bo.getData().get("ids");
//        if (ObjectUtils.isEmpty(ids)) {
//            return SingleResponse.buildFailure("-1", "请求参数ids不能为空");
//        }
//
//        String fileType = (String) bo.getData().get("fileType");
//        ReportType reportType = ReportType.get(fileType);
//
//        if (reportType == null) {
//            return SingleResponse.buildFailure("-1", "请求参数fileType不能为空");
//        }
//
//        SingleResponse<BOList> singleResponse = BoQueryUtils.Builder(ModelConst.T_MEMBER_PURCHASE_ORDER)
//                .condition()
//                .in("id", ids)
//                .End().listBO();
//        if (!singleResponse.isSuccess()) {
//            return singleResponse;
//        }
//        List<Map<String, Object>> data = singleResponse.getData().getData();
//
//        if (data.isEmpty()) {
//            return SingleResponse.buildFailure("-1", "未获取到下载数据");
//        }
//
//        String exportField = "{\"fullName\":\"vendor_name\",\"id\":\"id\",\"brand\":\"brand\",\"name\":\"name\",\"unit\":\"unit\",\"amount\":\"purchase_amount\",\"time\":\"createdTime\",\"num\":\"num\",\"price\":\"price\",\"poCode\":\"po_code\",\"cloudOrderIds\":\"cloud_order_ids\",\"vendorName\":\"vendor_name\",\"transferVendorContacts\":\"transfer_order_id\",\"transferVendorMobile\":\"phone\",\"transferVendorEmail\":\"postal\",\"mobile\":\"phone\",\"email\":\"email\",\"cloudOrderId\":\"cloud_order_id\",\"modelAndSpec\":\"model\",\"invoiceRate\":\"invoice_rate\",\"memo\":\"memo\",\"deliveryTime\":\"delivery_time\",\"receiveMessage\":\"remark_message\",\"paymentName\":\"payment_name\",\"preAmount\":\"pre_amount\"}";
//        JSONObject exportJson = JSON.parseObject(exportField);
//        List<Map<String, Object>> fileData = data.stream().map(m -> {
//            Map<String, Object> mf = new HashMap<>();
//            for (String key : exportJson.keySet()) {
//                mf.put(exportJson.getString(key), m.get(key));
//            }
//            return mf;
//        }).collect(Collectors.toList());
//
//
//        if (log.isDebugEnabled()) {
//            log.debug("======================转采管理-采购订单明细-打印采购合同:reportType={},fileData={}", reportType.getId(), JSON.toJSONString(fileData));
//        }
//        ReportUtils.exportReport("purchase/purchase_invoice_print.html", reportType.getId(), fileData);
//
//        return SingleResponse.buildSuccess();
//    }
//
//
//}
